﻿@page "/validateforms"
@inject IStringLocalizer<ValidateForms> Localizer

<h3>@Localizer["ValidateFormsTitle"]</h3>

<h4>@Localizer["ValidateFormsSubTitle"]</h4>

<DemoBlock Title="@Localizer["ValidateFormNormalTitle"]" Introduction="@Localizer["ValidateFormNormalIntro"]" Name="Normal" Demo="typeof(Demos.ValidateForms.ValidateFormNormal)">
    <p><b>@Localizer["ValidateFormNormalBasicUsageDescription"]</b></p>
    <ul class="ul-demo mb-3">
        <li>@((MarkupString)Localizer["ValidateFormNormalLi1"].Value)</li>
        <li>@((MarkupString)Localizer["ValidateFormNormalLi2"].Value)</li>
        <li>@((MarkupString)Localizer["ValidateFormNormalLi3"].Value)</li>
        <li>@((MarkupString)Localizer["ValidateFormNormalLi4"].Value)</li>
        <li>@((MarkupString)Localizer["ValidateFormNormalLi5"].Value)</li>
        <li>@((MarkupString)Localizer["ValidateFormNormalLi6"].Value)</li>
        <li>@((MarkupString)Localizer["ValidateFormNormalLi7"].Value)</li>
        <li>@((MarkupString)Localizer["ValidateFormNormalLi9"].Value)</li>
    </ul>
    <p><b>@Localizer["ValidateFormNormalBasicUsageDescription2"]</b></p>
    <ul class="ul-demo mb-3">
        <li>@((MarkupString)Localizer["ValidateFormNormalLi8"].Value)</li>
        <li>@((MarkupString)Localizer["ValidateFormNormalFormLabelWidth"].Value)</li>
    </ul>
    <p>@((MarkupString)Localizer["LongDisplayDescription"].Value)</p>
</DemoBlock>

<DemoBlock Title="@Localizer["ValidateFormInnerComponentTitle"]" Introduction="@Localizer["ValidateFormInnerComponentIntro"]" Name="InnerComponent" Demo="typeof(Demos.ValidateForms.ValidateFormInnerComponent)">
    <p class="legend">@Localizer["ValidateFormInnerComponentInnerComponentLabel"]</p>
    <p>@Localizer["ValidateFormInnerComponentInnerComponentDescription1"]</p>
    <ul class="ul-demo mb-3">
        <li>@Localizer["ValidateFormInnerComponentInnerComponentLi1"]</li>
        <li>@Localizer["ValidateFormInnerComponentInnerComponentLi2"]</li>
        <li>@Localizer["ValidateFormInnerComponentInnerComponentLi3"]</li>
        <li>@Localizer["ValidateFormInnerComponentInnerComponentLi4"]</li>
        <li>@Localizer["ValidateFormInnerComponentInnerComponentLi5"]</li>
    </ul>
    <p>@((MarkupString)Localizer["ValidateFormInnerComponentInnerComponentDescription2"].Value)</p>
</DemoBlock>

<DemoBlock Title="@Localizer["ValidateFormCustomDisplsyErrorTitle"]" Introduction="@Localizer["ValidateFormCustomDisplsyErrorIntro"]" Name="CustomDisplsyError" Demo="typeof(Demos.ValidateForms.ValidateFormCustomDisplsyError)">
    <p>@((MarkupString)Localizer["ValidateFormCustomDisplsyErrorDescription"].Value)</p>
</DemoBlock>

<DemoBlock Title="@Localizer["ValidateFormValidatorAllFieldTitle"]" Introduction="@Localizer["ValidateFormValidatorAllFieldIntro"]" Name="ValidatorAllField" Demo="typeof(Demos.ValidateForms.ValidateFormValidatorAllField)">
    <p>@((MarkupString)Localizer["ValidateFormValidatorAllFieldDescription"].Value)</p>
</DemoBlock>

<DemoBlock Title="@Localizer["ValidateFormComplexValidationTitle"]" Introduction="@Localizer["ValidateFormComplexValidationIntro"]" Name="ComplexValidation" Demo="typeof(Demos.ValidateForms.ValidateFormComplexValidation)">
    <p>@((MarkupString)Localizer["ValidateFormComplexValidationDescription"].Value)</p>
    <Pre>@Localizer["ValidateFormComplexValidationPre"]</Pre>
</DemoBlock>

<DemoBlock Title="@Localizer["ValidateFormDynamicFormTitle"]" Introduction="@Localizer["ValidateFormDynamicFormIntro"]" Name="DynamicForm" Demo="typeof(Demos.ValidateForms.ValidateFormDynamicForm)">
    <p>@((MarkupString)Localizer["ValidateFormDynamicFormDescription"].Value)</p>
</DemoBlock>

<DemoBlock Title="@Localizer["ValidateFormInnerFormLabelTitle"]" Introduction="@Localizer["ValidateFormInnerFormLabelIntro"]" Name="InnerFormLabel" Demo="typeof(Demos.ValidateForms.ValidateFormInnerFormLabel)">
    <p>@((MarkupString)Localizer["ValidateFormInnerFormLabelDescription"].Value)</p>
    <Pre>&lt;EditorItem @@bind-Field="@@context.Address" ValidateRules="@@CustomerRules" /&gt;</Pre>
</DemoBlock>

<DemoBlock Title="@Localizer["ValidateFormCustomValidationFormTitle"]" Introduction="@Localizer["ValidateFormCustomValidationFormIntro"]" Name="CustomValidationForm" Demo="typeof(Demos.ValidateForms.ValidateFormCustomValidationForm)">
    <p>@((MarkupString)Localizer["CustomValidationFormP1"].Value)</p>
    <Pre>protected override void OnInitialized()
{
    base.OnInitialized();
    // @Localizer["CustomValidationFormComment1"]
    CustomerRules.Add(new CustomerValidator(new EmailAddressAttribute()));

    // @Localizer["CustomValidationFormComment2"]
    // &lt;BootstrapInput @@bind-Value="@@Model.Address" ValidateRules="@@CustomerRules" /&gt;
}</Pre>
</DemoBlock>

<DemoBlock Title="@Localizer["ValidateFormValidateTitle"]" Introduction="@Localizer["ValidateFormValidateIntro"]" Name="Validate" Demo="typeof(Demos.ValidateForms.ValidateFormValidate)">
    <p>@((MarkupString)Localizer["ValidateFormValidateDescription"].Value)</p>
    <Pre>[NotNull]
private ValidateForm? ValidatorForm { get; set; }

private Task OnClickValidate()
{
    ValidatorForm.Validate();
    return Task.CompletedTask;
}</Pre>
</DemoBlock>

<DemoBlock Title="@Localizer["ValidateFormDisableAutoSubmitFormByEnterTitle"]" Introduction="@Localizer["ValidateFormDisableAutoSubmitFormByEnterIntro"]" Name="DisableAutoSubmitFormByEnter" Demo="typeof(Demos.ValidateForms.ValidateFormDisableAutoSubmitFormByEnter)">
    <p>@((MarkupString)Localizer["DisableAutoSubmitFormByEnterDesc"].Value)</p>
</DemoBlock>

<AttributeTable Items="@GetAttributes()" />

<MethodTable Items="@GetMethods()" />
